﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Model
{
    /// <summary>
    /// RESPONSANILITY: - role repository
    ///                 - create a new role
    ///                 - delete a role 
    /// </summary>
    public class ChangeRole
    {
        public List<Role> roles;

        public void CreateRole(string roleName, IBonusWage bonus)
        {

            Role role = new Role(roleName, bonus);
            foreach (Role _role in roles)
            {
                try
                {
                    if (_role.RoleName != roleName)
                        roles.Add(_role);
                }
                catch { }
            }       
        }

        public void DeleteRole(Role role,string roleName)
        {
            var deleteRole = roles.FirstOrDefault(r => r.RoleName == roleName);
            if (deleteRole != null)
                roles.Remove(role);
        }
    }
}
